using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;

namespace PlacementManager
{
    public partial class VenueComponent
    {
        /// <summary>
        /// Selects all records from the database table.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public List<Venue> SelectAllWParentVenueId(int parentVenueId, string sortExpression)
        {
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllWParentVenueId(parentVenueId);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public Venue SelectOneWVenueName(string venueName)
        {
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();
            DataTable dt = o.SelectOneWVenueName(venueName).Tables[0];

            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];
                PlacementManager.Venue VenueToReturn = new PlacementManager.Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]);
                return VenueToReturn;
            }
            else
            {
                PlacementManager.Venue VenueToReturnEmpty = new PlacementManager.Venue();
                return VenueToReturnEmpty;
            }
        }

        /// <summary>
        /// Selects all available for a placement type.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllAvailableWPlacementTypeId(int placementTypeId, string sortExpression)
        {
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllAvailableWPlacementTypeId(placementTypeId);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        /// <summary>
        /// Selects all available for a placement type.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllAvailableAssocWUnitWPlacementTypeId(int placementTypeId, string sortExpression)
        {
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllAvailableAssocWUnitWPlacementTypeId(placementTypeId);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        /// <summary>
        /// Selects all available for a placement type.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllAvailableAssocWCategoryWPlacementTypeId(int placementTypeId, string sortExpression)
        {
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllAvailableAssocWCategoryWPlacementTypeId(placementTypeId);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        /// <summary>
        /// Selects all available for a placement type.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllActiveStartingWith(string prefix, string sortExpression)
        {
            if (prefix == null)
            {
                prefix = "";
            }

            if (sortExpression.Length == 0)
            {
                sortExpression = "VenueName";
            }
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllActiveStartingWith(prefix);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllActiveWithOutAddress(string sortExpression)
        {

            if (sortExpression.Length == 0)
            {
                sortExpression = "VenueName";
            }
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllActiveWithoutAddress();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllActiveWithoutTelephone(string sortExpression)
        {

            if (sortExpression.Length == 0)
            {
                sortExpression = "VenueName";
            }
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllActiveWithoutTelephone();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllActiveWithoutCategory(string sortExpression)
        {

            if (sortExpression.Length == 0)
            {
                sortExpression = "VenueName";
            }
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllActiveWithoutCategory();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllActiveWithoutUnit(string sortExpression)
        {

            if (sortExpression.Length == 0)
            {
                sortExpression = "VenueName";
            }
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllActiveWithoutCategory();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }
        /// <summary>
        /// Selects all available for a placement type.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public List<Venue> SelectAllAvailableAssocWUnitWCampusWPlacementTypeId(int placementTypeId, string sortExpression)
        {
            List<Venue> listVenue = new List<Venue>();
            PlacementManager.DAL.Venue_DAL o = new PlacementManager.DAL.Venue_DAL();

            DataSet ds = o.SelectAllAvailableAssocWUnitWCampusWPlacementTypeId(placementTypeId);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listVenue.Add(new Venue((int)row["VenueId"], (string)row["VenueName"], (int)row["ParentVenueId"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsActive"], (DateTime)row["DateCreated"], (string)row["CreatedBy"], (DateTime)row["DateUpdated"], (string)row["UpdatedBy"]));
            }

            listVenue.Sort(new VenueComparer(sortExpression));
            return listVenue;
        }
    }
}
